/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package control;

import java.sql.ResultSet;
import java.sql.SQLException;
import model.Login;
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
import utility.ConnectDB;

/**
 *
 * @author Dom
 */
public class LoginController {
    public Boolean Login(Login log) throws SQLException
    {
       Login trave = new Login();
       
        String sql = "SELECT ID FROM DangNhap WHERE " + "UserName='" + log.getUserName() + "'AND Password='" + log.getPassword() + "'";
        //System.out.println(sql);
        ResultSet rs = ConnectDB.getResultSet(sql);
        
        int cout=0;
        while(rs.next())
        {
            cout++;
        }
        if(cout == 1)
            return true;
        else
            return false;
        
    }
    
}
